home *** CD-ROM | disk | FTP | other *** search
/ QuickTime for the Web (2nd Edition) / QuickTime for the Web (2nd Edition).iso / pc / Demos / Mac / Matthew's Behaviors / Matthew'sMotionƒ / 2SideSpin next >
Encoding:
INI File  |  2001-09-10  |  1.8 KB  |  48 lines

  1. [Name]
  2. 2SideSpin - From Matthew's Motion Suite.
  3. By Matthew Peterson, matthew@pinoko.berkeley.edu
  4.  
  5. [Description]
  6. 2-19-2000
  7. Drop this on a sprite, and it will roll spin in 3D. It will display a 
  8. different image on the two sides. Set the image index in the
  9. parameters.
  10.  
  11. [Parameters]
  12.  
  13. Side 1 Image Index, MP_SpinSideOneImage,1
  14. Side 2 Image Index, MP_SpinSideTwoImage,2
  15.  
  16. [Frame loaded]
  17. spritevars originalspincenterx originalspincentery spincenterx spincentery spinanglestep originalheight
  18.  
  19. spriteofid($thisspriteid).executeevent(200082)
  20. originalheight = spriteofid($thisspriteid).boundsbottom - spriteofid($thisspriteid).boundstop
  21. originalspincenterx = spincenterx
  22. originalspincentery = spincentery
  23. spinanglestep = 7
  24.  
  25. [Idle]
  26. SpriteVars spinangle spinanglestep originalheight originalspincenterx originalspincentery spincenterx spincentery spinanglestep
  27. localvars temporaryx temporaryy spinheight
  28.  
  29. spinangle = (spinangle + spinanglestep + 720 ) rem 360
  30. setimageindexto($MP_SpinSideOneImage)
  31. resetmatrix
  32. rotate(spinangle)
  33. spinheight = (SecondCornerY - FirstCornerY) * 0.1
  34. if(spinangle <= 90 or spinangle >= 270) 
  35. Stretch(FirstCornerX,SecondCornerY - spinheight,SecondCornerX, SecondCornerY + spinheight, SecondCornerX,SecondCornerY + originalheight - spinheight,FirstCornerX,SecondCornerY + originalheight + spinheight)
  36. else
  37.     setimageindexto($MP_SpinSideTwoImage)
  38. Stretch(SecondCornerX, SecondCornerY + spinheight,FirstCornerX,SecondCornerY - spinheight,FirstCornerX,SecondCornerY + originalheight + spinheight, SecondCornerX,SecondCornerY + originalheight - spinheight)
  39. endif
  40. executeevent(200082)
  41. MoveBy(originalspincenterx- spincenterx,originalspincentery - spincentery)
  42.  
  43. [200082 MP_CalculateSpinCenter]
  44. spritevars spincenterx spincentery
  45. //get the center of the sprite
  46. spincenterx = (boundsleft + boundsright)/2
  47. spincentery =  (boundstop + boundsbottom)/2
  48.